from selenium.webdriver.common.by import By
from common.base_page import BasePage

class ProdDetailPage(BasePage):
    # 添加购物车
    add_cart_button = (By.CLASS_NAME, 'add-cart')
    # 商品名字
    prod_name = (By.XPATH, '//div[@class="name-box"]/div[@class="name"]')

    # 点击添加购物车
    def click_add_cart(self):
        self.click_element(self.add_cart_button)

    # 获取商品名字用于断言
    def get_prod_name(self):
        return self.get_text(self.prod_name)

